package com.kelvem.saas.workbanch.core.exception;

import com.kelvem.saas.workbanch.fsm.entity.Entity;

/**
 * @author kelvem
 */
public class SaasException extends RuntimeException {

    private ErrorCodeEnum errorCode = ErrorCodeEnum.SYS_EXCEPTION;
    private String entityName;
    private String eventCode;


    public SaasException(String msg) {
        super(msg);
    }
    
    public SaasException(Class<? extends Entity> entityClazz, String msg) {
        super(msg);
        this.entityName = entityClazz.getSimpleName();
    }
    
    public SaasException(String entityName, String eventCode, String msg) {
        super(msg);
        this.entityName = entityName;
        this.eventCode = eventCode;
    }
    
    public SaasException(ErrorCodeEnum errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public SaasException(ErrorCodeEnum errorCode, Throwable ex) {
        super(errorCode.getMessage(), ex);
        this.errorCode = errorCode;
    }
    
    public SaasException(String msg, Throwable ex) {
        super(msg, ex);
    }



    public ErrorCodeEnum getErrorCode() {
        return errorCode;
    }

    public String getEntityName() {
        return entityName;
    }

    public String getEventCode() {
        return eventCode;
    }
}
